
import React, { useState,useEffect } from 'react';
import { Button, View, Text, StyleSheet } from 'react-native';

const Details = (state) => {
  const [url, setUrl] = useState('')
  useEffect(() => {
    setUrl(`点击跳转到:${state.route.params.url}`)
  }, []);
  const styles = StyleSheet.create({
    firstButtonStyle:{
      marginBottom: 10,
      height:40,
      lineHeight:40,
      textAlign:'center',
      borderRadius: 5,
      width:300,
      backgroundColor:"green",
    }
  })
  console.log('嘿嘿',styles); //上级路由带过来的参数
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text style={styles.firstButtonStyle}  onPress={() => state.navigation.navigate('Webview',{id:'test',url:'https://www.baidu.com/'})}>{url}</Text>
      {/* <Button
        title={url}
        onPress={() => state.navigation.navigate('Webview',{id:'test',url:'https://m.jd.com/'})}
      /> */}
      {/* <Button title="返回上一页" onPress={() => state.navigation.goBack()} /> */}
      <Button
        title="返回首页"
        onPress={() => state.navigation.popToTop()}
      />
    </View>
  );
}



  export default Details;